var gulp = require("gulp");
var browserify = require("browserify");
var source = require('vinyl-source-stream');
var tsify = require("tsify");
var paths = {
    pages: ['app/*.html']
};

gulp.task("copy-html", function () {
  return gulp.src(paths.pages)
      .pipe(gulp.dest("dist"));
});

gulp.task("simple_fill", ["copy-html"], function () {
  return browserify({
    basedir: '.',
    debug: true,
    entries: ['app/simple_fill.ts'],
    cache: {},
    packageCache: {}
  })
  .plugin(tsify)
  .bundle()
  .pipe(source('simple_fill.js'))
  .pipe(gulp.dest("dist"));
});

gulp.task("pattern_fill", ["copy-html"], function () {
  return browserify({
    basedir: '.',
    debug: true,
    entries: ['app/pattern_fill.ts'],
    cache: {},
    packageCache: {}
  })
  .plugin(tsify)
  .bundle()
  .pipe(source('pattern_fill.js'))
  .pipe(gulp.dest("dist"));
});